# Copyright 2019 Google LLC
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
#     http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.

# NOTE: This file is auto generated by the elixir code generator program.
# Do not edit this file manually.

defmodule GoogleApi.CloudDeploy.V1.Model.TimedPromoteReleaseRule do
  @moduledoc """
  The `TimedPromoteReleaseRule` will automatically promote a release from the current target(s) to the specified target(s) on a configured schedule.

  ## Attributes

  *   `condition` (*type:* `GoogleApi.CloudDeploy.V1.Model.AutomationRuleCondition.t`, *default:* `nil`) - Output only. Information around the state of the Automation rule.
  *   `destinationPhase` (*type:* `String.t`, *default:* `nil`) - Optional. The starting phase of the rollout created by this rule. Default to the first phase.
  *   `destinationTargetId` (*type:* `String.t`, *default:* `nil`) - Optional. The ID of the stage in the pipeline to which this `Release` is deploying. If unspecified, default it to the next stage in the promotion flow. The value of this field could be one of the following: * The last segment of a target name * "@next", the next target in the promotion sequence
  *   `id` (*type:* `String.t`, *default:* `nil`) - Required. ID of the rule. This ID must be unique in the `Automation` resource to which this rule belongs. The format is `[a-z]([a-z0-9-]{0,61}[a-z0-9])?`.
  *   `schedule` (*type:* `String.t`, *default:* `nil`) - Required. Schedule in crontab format. e.g. "0 9 * * 1" for every Monday at 9am.
  *   `timeZone` (*type:* `String.t`, *default:* `nil`) - Required. The time zone in IANA format [IANA Time Zone Database](https://www.iana.org/time-zones) (e.g. America/New_York).
  """

  use GoogleApi.Gax.ModelBase

  @type t :: %__MODULE__{
          :condition => GoogleApi.CloudDeploy.V1.Model.AutomationRuleCondition.t() | nil,
          :destinationPhase => String.t() | nil,
          :destinationTargetId => String.t() | nil,
          :id => String.t() | nil,
          :schedule => String.t() | nil,
          :timeZone => String.t() | nil
        }

  field(:condition, as: GoogleApi.CloudDeploy.V1.Model.AutomationRuleCondition)
  field(:destinationPhase)
  field(:destinationTargetId)
  field(:id)
  field(:schedule)
  field(:timeZone)
end

defimpl Poison.Decoder, for: GoogleApi.CloudDeploy.V1.Model.TimedPromoteReleaseRule do
  def decode(value, options) do
    GoogleApi.CloudDeploy.V1.Model.TimedPromoteReleaseRule.decode(value, options)
  end
end

defimpl Poison.Encoder, for: GoogleApi.CloudDeploy.V1.Model.TimedPromoteReleaseRule do
  def encode(value, options) do
    GoogleApi.Gax.ModelBase.encode(value, options)
  end
end
